
package com.doit.excersise;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@SpringBootApplication
@MapperScan("com.doit.excersise.mapper")
public class ExcersiseApplication implements WebMvcConfigurer {
	public static void main(String[] args) {
		SpringApplication.run(ExcersiseApplication.class, args);
	}
	
	 @Override
	public void addCorsMappings(CorsRegistry registry) {
	        registry
	        .addMapping("/**")
	                .allowedOrigins("*")
	                .allowedMethods("POST", "GET", "PUT", "OPTIONS", "DELETE")
	                .maxAge(3600)
	                ;;
	}

	@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		// TODO Auto-generated method stub
		 registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
	}        
	 
	 
}
